<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>09两个表单小方法</title>
    <script>
        window.onload = function(){
            //页面加载完毕自动获取焦点
            var focus = document.getElementById("focus");
            focus.focus();

            //鼠标经过自动选中文本内容，方便用户删除
            var sel = document.getElementById("sel");
            sel.onmouseover = function(){
                this.select();
            }
        }
    </script>
</head>
<body>
<input type="text" id="focus"><br>
<input type="text" id="sel">
</body>
</html>